﻿using System.Diagnostics;
using WWLauncher.ViewModel;

namespace WWLauncher.Util
{
    [DebuggerStepThrough]
    public static class MapperExtension
    {
        public static IconInfo To(this IconViewModel source)
        {
            if (source == null)
            {
                return null;
            }
            var info = new IconInfo();
            info.Id = source.Id;
            info.Name = source.Name;
            info.TargetPath = source.TargetPath;
            info.ImageByteArr = source.ImageByteArr;
            info.LnkPath = source.LnkPath;
            info.RelativePath = source.RelativePath;
            info.StartArg = source.StartArg;
            info.StartType = source.StartType;
            info.IsStartup = source.IsStartup;
            info.LinkId = source.LinkId;

            return info;
        }

        public static IconViewModel To(this IconInfo source)
        {
            if (source == null)
            {
                return null;
            }

            var info = new IconViewModel(); 
            info.Id = source.Id;
            info.Name = source.Name;
            info.TargetPath = source.TargetPath;
            info.ImageByteArr = source.ImageByteArr;
            info.LnkPath = source.LnkPath;
            info.RelativePath = source.RelativePath;
            info.StartArg = source.StartArg;
            info.StartType = source.StartType;
            info.IsStartup = source.IsStartup;
            info.LinkId = source.LinkId;
            
            return info;
        }
    }
}
